package org.nowcoder.huawei.c100;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * 70:山峰个数
 */
public class HC070 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] nums = br.readLine().split(",");
        int[] hills = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            hills[i] = Integer.parseInt(nums[i]);
        }
        System.out.println(solve(hills, hills.length));
    }

    public static int solve(int[] hills, int len) {
        if (len == 1) {
            if (hills[0] != 0) {
                return 1;
            } else {
                return 0;
            }
        }
        if (len == 2) {
            if (hills[0] == 0 && hills[1] == 0) {
                return 0;
            } else {
                return 1;
            }
        }
        int count = 0;
        for (int i = 0; i < len; i++) {
            if (i == 0) {
                if (hills[i] > hills[i + 1]) {
                    count++;
                }
            } else if (i == len - 1) {
                if (hills[i] > hills[i - 1]) {
                    count++;
                }
            } else {
                if (hills[i] > hills[i - 1] && hills[i] > hills[i + 1]) {
                    count++;
                }
            }
        }
        return count;
    }
}
